﻿<sdk:Page Title="Articles" 
xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk"
xmlns:input="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Input" x:Class="DemoNYTimes.ArticlesPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:charting="clr-namespace:System.Windows.Controls.DataVisualization.Charting;assembly=System.Windows.Controls.DataVisualization.Toolkit"
    xmlns:chartingprimatives="clr-namespace:System.Windows.Controls.DataVisualization.Charting.Primitives;assembly=System.Windows.Controls.DataVisualization.Toolkit"
    xmlns:controls="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Toolkit"    
    xmlns:basics="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls"
    xmlns:datavis="clr-namespace:System.Windows.Controls.DataVisualization;assembly=System.Windows.Controls.DataVisualization.Toolkit" 
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
    xmlns:nyt="clr-namespace:NYTimes;assembly=NYTimesSilverlightKit"
    xmlns:nytvc="clr-namespace:NYTimes.ValueConverters;assembly=NYTimesSilverlightKit"
    xmlns:vsm="clr-namespace:System.Windows;assembly=System.Windows"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
	d:DesignWidth="640" d:DesignHeight="480" mc:Ignorable="d">
    <sdk:Page.Resources>
        
        <nyt:Articles x:Key="Articles" d:IsDataSource="true" 
			Facets="des_facet, per_facet, geo_facet, org_facet" 
			Fields="body, byline, date, small_image_height, small_image_width, small_image_url, title, url, des_facet, per_facet, geo_facet"
			ResultsToGet="40"/>
        <nyt:TimesTags x:Key="Tags" d:IsDataSource="true"/>
        <nytvc:DictionaryWebdingConverter x:Key="DictionaryWebdingConverter"/>
        <nytvc:DateTimeConverter x:Key="DateTimeConverter"/>
        <nytvc:FacetNameConverter x:Key="FacetNameConverter"/>
        <nytvc:NumericFormatConverter x:Key="NumericFormatConverter"/>
        <nytvc:TagConverter x:Key="TagConverter"/>
        <nytvc:VisibleIfNotNullOrEmptyConverter x:Key="VisibleIfNotNullOrEmptyConverter"/>
        
        
        <!--Default TabItem Styel-->
        <Style x:Key="TabItemStyle1" TargetType="basics:TabItem">
            <Setter Property="FontSize" Value="12"/>
            <Setter Property="FontFamily" Value="Arial"/>
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="basics:TabItem">
                        <Grid x:Name="Root">
                            <vsm:VisualStateManager.VisualStateGroups>

                                <vsm:VisualStateGroup x:Name="CommonStates">
                                    <vsm:VisualState x:Name="Normal" />
                                </vsm:VisualStateGroup>
                                <vsm:VisualStateGroup x:Name="SelectionStates">
                                    <vsm:VisualState x:Name="Unselected" />
                                    <vsm:VisualState x:Name="Selected" />
                                </vsm:VisualStateGroup>
                                <vsm:VisualStateGroup x:Name="FocusStates">
                                </vsm:VisualStateGroup>
                            </vsm:VisualStateManager.VisualStateGroups>


                            <Grid x:Name="TemplateTopSelected" Visibility="Collapsed" >
                                <Border Background="#FFFFFF" BorderBrush="#CCCCCC" BorderThickness="1,1,1,0" Margin="0,0,0,0">
                                    <Grid>
                                        <ContentControl x:Name="HeaderTopSelected" IsTabStop="False"
                                                        Foreground="{TemplateBinding Foreground}"
                                                        FontSize="{TemplateBinding FontSize}"
                                                        HorizontalAlignment="Center"
                                                        VerticalAlignment="Center"
                                                        Margin="{TemplateBinding Padding}"
                                                        Cursor="{TemplateBinding Cursor}" />
                                    </Grid>
                                </Border>
                            </Grid>
                            <Grid x:Name="TemplateTopUnselected" Visibility="Collapsed" Canvas.ZIndex="1">
                                <Border Background="#F0F4F5" BorderBrush="#CCCCCC" BorderThickness="1,1,1,1" Margin="0,0,0,0">
                                    <Grid>
                                        <ContentControl x:Name="HeaderTopUnselected" IsTabStop="False"
                                                        Foreground="{TemplateBinding Foreground}"
                                                        FontSize="{TemplateBinding FontSize}"
                                                        HorizontalAlignment="Center"
                                                        VerticalAlignment="Center"
                                                        Margin="{TemplateBinding Padding}"
                                                        Cursor="{TemplateBinding Cursor}" />
                                    </Grid>
                                </Border>
                            </Grid>
                            <Grid x:Name="TemplateBottomSelected" Visibility="Collapsed" Canvas.ZIndex="1">
                                <Border BorderBrush="#CCCCCC" BorderThickness="1,0,1,1" Margin="-2,0,-2,-2">
                                    <Grid>
                                        <ContentControl x:Name="HeaderBottomSelected" IsTabStop="False"
                                                        Foreground="{TemplateBinding Foreground}"
                                                        FontSize="{TemplateBinding FontSize}"
                                                        HorizontalAlignment="Center"
                                                        VerticalAlignment="Center"
                                                        Margin="{TemplateBinding Padding}"
                                                        Cursor="{TemplateBinding Cursor}" />
                                    </Grid>
                                </Border>
                            </Grid>
                            <Grid x:Name="TemplateBottomUnselected" Visibility="Collapsed">
                                <Border Background="#F0F4F5" BorderBrush="#CCCCCC" BorderThickness="1,0,1,1">
                                    <Grid>
                                        <ContentControl x:Name="HeaderBottomUnselected" IsTabStop="False"
                                                        Foreground="{TemplateBinding Foreground}"
                                                        FontSize="{TemplateBinding FontSize}"
                                                        HorizontalAlignment="Center"
                                                        VerticalAlignment="Center"
                                                        Margin="{TemplateBinding Padding}"
                                                        Cursor="{TemplateBinding Cursor}" />
                                    </Grid>
                                </Border>
                            </Grid>
                            <Grid x:Name="TemplateLeftSelected" Visibility="Collapsed" Canvas.ZIndex="1">
                                <Border BorderBrush="#CCCCCC" BorderThickness="1,1,0,1" Margin="-2,-2,0,-2">
                                    <Grid>
                                        <ContentControl x:Name="HeaderLeftSelected" IsTabStop="False"
                                                        Foreground="{TemplateBinding Foreground}"
                                                        FontSize="{TemplateBinding FontSize}"
                                                        HorizontalAlignment="Center"
                                                        VerticalAlignment="Center"
                                                        Margin="{TemplateBinding Padding}"
                                                        Cursor="{TemplateBinding Cursor}" />
                                    </Grid>
                                </Border>
                            </Grid>
                            <Grid x:Name="TemplateLeftUnselected" Visibility="Collapsed">
                                <Border Background="#F0F4F5" BorderBrush="#CCCCCC" BorderThickness="1,1,0,1">
                                    <Grid>
                                        <ContentControl x:Name="HeaderLeftUnselected" IsTabStop="False"
                                                        Foreground="{TemplateBinding Foreground}"
                                                        FontSize="{TemplateBinding FontSize}"
                                                        HorizontalAlignment="Center"
                                                        VerticalAlignment="Center"
                                                        Margin="{TemplateBinding Padding}"
                                                        Cursor="{TemplateBinding Cursor}" />
                                    </Grid>
                                </Border>
                            </Grid>
                            <Grid x:Name="TemplateRightSelected" Visibility="Collapsed" Canvas.ZIndex="1">
                                <Border BorderBrush="#CCCCCC" BorderThickness="0,1,1,1" Margin="0,-2,-2,-2">
                                    <Grid>
                                        <ContentControl x:Name="HeaderRightSelected" IsTabStop="False"
                                                        Foreground="{TemplateBinding Foreground}"
                                                        FontSize="{TemplateBinding FontSize}"
                                                        HorizontalAlignment="Center"
                                                        VerticalAlignment="Center"
                                                        Margin="{TemplateBinding Padding}"
                                                        Cursor="{TemplateBinding Cursor}" />
                                    </Grid>
                                </Border>
                            </Grid>
                            <Grid x:Name="TemplateRightUnselected" Visibility="Collapsed">
                                <Border Background="#F0F4F5" BorderBrush="#CCCCCC" BorderThickness="0,1,1,1">
                                    <Grid>
                                        <ContentControl x:Name="HeaderRightUnselected" IsTabStop="False"
                                                        Foreground="{TemplateBinding Foreground}"
                                                        FontSize="{TemplateBinding FontSize}"
                                                        HorizontalAlignment="Center"
                                                        VerticalAlignment="Center"
                                                        Margin="{TemplateBinding Padding}"
                                                        Cursor="{TemplateBinding Cursor}" />
                                    </Grid>
                                </Border>
                            </Grid>
                        </Grid>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
        
        
        <DataTemplate x:Key="ItemsTemplate">
            <TextBlock Text="{Binding Mode=OneWay}"/>
        </DataTemplate>
        
        
        <ItemsPanelTemplate x:Key="ProductPanel">
            <StackPanel Orientation="Horizontal"/>
        </ItemsPanelTemplate>
        
        
        <Style x:Key="AutocompleteStyle" TargetType="input:AutoCompleteBox">
            <Setter Property="HorizontalAlignment" Value="Stretch"/>
            <Setter Property="FontFamily" Value="Arial"/>
            <Setter Property="FontSize" Value="14" />
        </Style>
        
        <!-- Default Button Style -->
        <Style x:Key="DefaultButtonStyle" TargetType="Button">
            <Setter Property="BorderBrush" Value="#999999" />
            <Setter Property="BorderThickness" Value="1" />
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="Button">
                        <Border x:Name="Root" Padding="3" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}">
                            <Border.Background>
                                <SolidColorBrush x:Name="Root_Brush" Color="Transparent" />
                            </Border.Background>
                            <vsm:VisualStateManager.VisualStateGroups>
                                <vsm:VisualStateGroup x:Name="CommonStates">
                                    <vsm:VisualState x:Name="Normal" />

                                    <vsm:VisualState x:Name="MouseOver">
                                        <Storyboard>
                                            <ColorAnimation Duration="0:0:0" Storyboard.TargetName="Root_Brush" Storyboard.TargetProperty="Color" To="#F0F4F5" />
                                        </Storyboard>
                                    </vsm:VisualState>
                                    
                                    <vsm:VisualState x:Name="Pressed">
                                        <Storyboard>
                                            <ColorAnimation Duration="0:0:0" Storyboard.TargetName="Root_Brush" Storyboard.TargetProperty="Color" To="#888888" />
                                        </Storyboard>
                                    </vsm:VisualState>
                                </vsm:VisualStateGroup>
                            </vsm:VisualStateManager.VisualStateGroups>
                            <ContentPresenter VerticalAlignment="Center" HorizontalAlignment="Center"/>
                        </Border>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
        
        
        <!-- ChartLegendStyle -->
        <Style x:Key="ChartLegendStyle" TargetType="datavis:Legend">
            <Setter Property="FontFamily" Value="Arial"/>
            <Setter Property="BorderBrush" Value="{x:Null}"/>
        </Style>
        <!-- ChartTitleStyle -->
        <Style x:Key="ChartTitleStyle" TargetType="datavis:Title">
            <Setter Property="FontFamily" Value="Arial"/>
            <Setter Property="FontWeight" Value="Bold" />
            <Setter Property="FontSize" Value="14"/>
        </Style>
        <!--Chart PlotAreaStyel -->
        <Style x:Key="PlotAreaStyle1" TargetType="Grid">
            <Setter Property="Background" Value="White" />
        </Style>
        <!--FacetLegendItem Style-->
        <Style x:Key="FacetLegendItemStyle" TargetType="charting:LegendItem">
            <Setter Property="IsTabStop" Value="False"/>
            <Setter Property="FontFamily" Value="Arial"/>
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="charting:LegendItem">
                        <Grid Height="Auto" Width="Auto">
                            <Rectangle Height="Auto" HorizontalAlignment="Stretch" Width="Auto" Fill="#FFF1FF00" Stroke="#FF000000" RadiusX="3" RadiusY="3" x:Name="SelectedRect" Visibility="Collapsed"/>
                            <StackPanel Orientation="Horizontal">
                                <Rectangle Height="8" Margin="0,0,3,0" Width="8" Fill="{Binding Path=Background}" Stroke="{Binding Path=BorderBrush}" StrokeThickness="1"/>
                                <datavis:Title FontFamily="Arial" Content="{TemplateBinding Content}" />

                            </StackPanel>
                        </Grid>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
        <!-- Chart Style -->
        <ControlTemplate x:Key="DefaultChartTemplate" TargetType="charting:Chart">
            <Border Background="{TemplateBinding Background}" BorderThickness="{TemplateBinding BorderThickness}" Padding="10">
                <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="2*" />
                        <RowDefinition Height="1*" />
                    </Grid.RowDefinitions>
                    
                    <!-- Chart Area -->
                    <chartingprimatives:EdgePanel x:Name="ChartArea" Grid.Row="0" Style="{TemplateBinding ChartAreaStyle}">


                        <!-- Plot Area -->
                        <Grid x:Name="PlotArea" Style="{TemplateBinding PlotAreaStyle}">

                            <!-- Required containers -->
                            <Grid x:Name="GridLinesContainer" />
                            <Grid x:Name="SeriesContainer" Visibility="Visible" />

                            <Border BorderBrush="{x:Null}"
                            BorderThickness="1" />
                        </Grid>

                    </chartingprimatives:EdgePanel>

                    <!-- Legend -->
                    <datavis:Legend x:Name="Legend"
                        Style="{TemplateBinding LegendStyle}"
                        Grid.Row="1"
                        BorderBrush="{x:Null}"
                        Background="{x:Null}" />
                    <!--<datavis:Legend x:Name="Legend"
                        Style="{TemplateBinding LegendStyle}"
                        Grid.Row="1"
                        Title="{TemplateBinding LegendTitle}"
                        BorderBrush="{x:Null}"
                        Background="{x:Null}" />-->

                </Grid>
            </Border>
        </ControlTemplate>


        <!-- TagResultTemplate-->
        <DataTemplate x:Key="TagResultTemplate">
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="16"/>
                    <ColumnDefinition Width="Auto"/>
                </Grid.ColumnDefinitions>
                <TextBlock VerticalAlignment="Center" FontSize="16" FontFamily="Webdings" Text="{Binding Converter={StaticResource DictionaryWebdingConverter}, Mode=OneWay, Path=Dictionary}" />
                <TextBlock Margin="4,0,0,0" VerticalAlignment="Center" FontFamily="Arial" FontSize="14" Grid.Column="1" Text="{Binding Mode=OneWay, Path=Value}" TextWrapping="NoWrap"/>
            </Grid>
        </DataTemplate>
        
        
        <!-- Article Template-->
        <DataTemplate x:Key="Article">
            <Border BorderThickness="0,0,0,1" BorderBrush="#CCCCCC" Margin="0,10,0,0">
                <Grid Margin="5">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="auto" />
                        <ColumnDefinition Width="*" />
                    </Grid.ColumnDefinitions>

                    <Image Margin="0,0,8,0" VerticalAlignment="Top" Grid.Column="0" Stretch="None"
                           Visibility="{Binding Converter={StaticResource VisibleIfNotNullOrEmptyConverter}, Mode=OneWay, Path=SmallImage}"
                           Source="{Binding Mode=OneWay, Path=SmallImage}" ImageFailed="OnImageFailed" />
                    <Grid Grid.Column="1" VerticalAlignment="Top">
                        <StackPanel>
                            <TextBlock Foreground="#333333" FontFamily="Arial" FontSize="16" TextWrapping="Wrap" FontWeight="Bold" Text="{Binding Mode=OneWay, Path=Title}"/>
                            <TextBlock Foreground="#333333" FontFamily="Arial" FontSize="14" TextWrapping="Wrap" Text="{Binding Mode=OneWay, Path=Body}" />

                            <Grid Margin="0,5,0,0">
                                <StackPanel Orientation="Horizontal" HorizontalAlignment="Left">
                                    <TextBlock Foreground="#909090" FontFamily="Arial" FontSize="11" TextWrapping="Wrap" Text="{Binding Converter={StaticResource DateTimeConverter}, ConverterParameter=d, Mode=OneWay, Path=Date}" />
                                    <TextBlock Foreground="#909090" FontFamily="Arial" FontSize="11" TextWrapping="Wrap" Text=" - " />
                                    <TextBlock Foreground="#909090" FontFamily="Arial" FontSize="11" TextWrapping="Wrap" Text="{Binding Mode=OneWay, Path=Byline}" />
                                </StackPanel>
                                <HyperlinkButton HorizontalAlignment="Right" FontFamily="Arial" FontSize="11" Content="Read More..." NavigateUri="{Binding Mode=OneWay, Path=Url}" TargetName="_blank" />
                            </Grid>
                        </StackPanel>
                    </Grid>
                </Grid>
            </Border>
        </DataTemplate>
    </sdk:Page.Resources>
    
    <Grid x:Name="LayoutRoot" Background="White">
        <Grid>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="*"/>
                <ColumnDefinition Width="*"/>
            </Grid.ColumnDefinitions>
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto"/>
                <RowDefinition/>
            </Grid.RowDefinitions>
            <Grid Margin="10,20,5,20">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition/>
                    <ColumnDefinition Width="Auto"/>
                    <ColumnDefinition Width="Auto"/>
                </Grid.ColumnDefinitions>
                <input:AutoCompleteBox x:Name="Query" 
                    DataContext="{StaticResource Tags}" 
                    FilterMode="None"
                    Style="{StaticResource AutocompleteStyle}"
                    IsTextCompletionEnabled="False" 
                    ItemsSource="{Binding Tags}"
                    ItemTemplate="{StaticResource TagResultTemplate}" 
                    ValueMemberBinding="{Binding Value}"
                    nyt:TimesTags.Service="{StaticResource Tags}"/>
                <Button HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Content="Search" FontFamily="Arial" MinWidth="70"
                        FontSize="10.5" Grid.Column="1" Margin="5,0,0,0" x:Name="SearchButton" Click="SearchButton_Click"
                        Style="{StaticResource DefaultButtonStyle}"/>
                
            </Grid>
            <StackPanel Orientation="Horizontal" Grid.Column="1" Margin="5,20,10,20" HorizontalAlignment="Right" VerticalAlignment="Bottom"
                        Visibility="{Binding Converter={StaticResource VisibleIfNotNullOrEmptyConverter}, Mode=OneWay, Path=Total}">
                <TextBlock Text="1-" FontFamily="Arial" FontSize="13.5"/>
                <TextBlock Text="{Binding Mode=OneWay, Path=Results.Count, Source={StaticResource Articles}}" FontFamily="Arial" FontSize="13.5"/>
                <TextBlock Text=" of " FontFamily="Arial" FontSize="13.5"/>
                <TextBlock Text="{Binding Converter={StaticResource NumericFormatConverter}, ConverterParameter=#\,###, Path=Total, Source={StaticResource Articles}}" FontFamily="Arial" FontSize="13.5"/>
                <TextBlock Text=" Results " FontFamily="Arial" FontSize="13.5"/>
            </StackPanel>

            <ListBox Height="Auto" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Margin="10,0,5,10" Width="Auto" Grid.Row="1"
                         x:Name="Articles" ItemsSource="{Binding Mode=OneWay, Path=Results, Source={StaticResource Articles}}"
                         ItemTemplate="{StaticResource Article}" ScrollViewer.HorizontalScrollBarVisibility="Disabled">
                <ListBox.ItemContainerStyle>
                    <!--Add Item Style to force ContentPresenter to Stretch Horizontally -->
                    <Style TargetType="ListBoxItem">
                        <Setter Property="Template">
                            <Setter.Value>
                                <ControlTemplate TargetType="ListBoxItem">
                                    <Grid>
                                        <ContentPresenter VerticalAlignment="Stretch" HorizontalAlignment="Stretch" />
                                    </Grid>
                                </ControlTemplate>
                            </Setter.Value>
                        </Setter>
                    </Style>
                </ListBox.ItemContainerStyle>
            </ListBox>
            <basics:TabControl Margin="5,0,10,10" Height="Auto" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Width="Auto" Grid.Row="1" Grid.Column="1">
                <basics:TabItem Header="Descriptions" x:Name="DescriptionsTab" Style="{StaticResource TabItemStyle1}">
                    <charting:Chart BorderThickness="0,0,0,1" BorderBrush="#CCCCCC" Title="Descriptions" x:Name="DescriptionFacet" 
                                    LegendStyle="{StaticResource ChartLegendStyle}" PlotAreaStyle="{StaticResource PlotAreaStyle1}" 
                                    Template="{StaticResource DefaultChartTemplate}">
                        <charting:PieSeries ItemsSource="{Binding Converter={StaticResource FacetNameConverter}, ConverterParameter=des_facet, Mode=OneWay, Path=FacetsReturned, Source={StaticResource Articles}}" DependentValueBinding="{Binding Path=Count}" IndependentValueBinding="{Binding Path=Term}" IsSelectionEnabled="True" LegendItemStyle="{StaticResource FacetLegendItemStyle}"/>
                    </charting:Chart>
                </basics:TabItem>
                <basics:TabItem Header="People" x:Name="PeopleTab" Style="{StaticResource TabItemStyle1}">
                    <charting:Chart BorderThickness="0,0,0,1" BorderBrush="#CCCCCC" Title="People" x:Name="PersonFacet" 
                                    LegendStyle="{StaticResource ChartLegendStyle}" PlotAreaStyle="{StaticResource PlotAreaStyle1}" 
                                    Template="{StaticResource DefaultChartTemplate}">
                        <charting:PieSeries ItemsSource="{Binding Converter={StaticResource FacetNameConverter}, ConverterParameter=per_facet, Mode=OneWay, Path=FacetsReturned, Source={StaticResource Articles}}" DependentValueBinding="{Binding Path=Count}" IndependentValueBinding="{Binding Path=Term}"/>
                    </charting:Chart>
                </basics:TabItem>
                <basics:TabItem Header="Locations" x:Name="LocationsTab" Style="{StaticResource TabItemStyle1}">
                    <charting:Chart BorderThickness="0,0,0,1" BorderBrush="#CCCCCC" Title="Locations" 
                                    LegendStyle="{StaticResource ChartLegendStyle}" PlotAreaStyle="{StaticResource PlotAreaStyle1}" 
                                    Template="{StaticResource DefaultChartTemplate}">
                        <charting:PieSeries ItemsSource="{Binding Converter={StaticResource FacetNameConverter}, ConverterParameter=geo_facet, Mode=OneWay, Path=FacetsReturned, Source={StaticResource Articles}}" DependentValueBinding="{Binding Path=Count}" IndependentValueBinding="{Binding Path=Term}"/>
                    </charting:Chart>
                </basics:TabItem>
                <basics:TabItem Header="Organizations" x:Name="OrganizationsTab" Style="{StaticResource TabItemStyle1}">
                    <charting:Chart BorderThickness="0,0,0,1" BorderBrush="#CCCCCC" Title="Organizations" 
                                    LegendStyle="{StaticResource ChartLegendStyle}" PlotAreaStyle="{StaticResource PlotAreaStyle1}" 
                                    Template="{StaticResource DefaultChartTemplate}">
                        <charting:PieSeries ItemsSource="{Binding Converter={StaticResource FacetNameConverter}, ConverterParameter=org_facet, Mode=OneWay, Path=FacetsReturned, Source={StaticResource Articles}}" DependentValueBinding="{Binding Path=Count}" IndependentValueBinding="{Binding Path=Term}"/>
                    </charting:Chart>
                </basics:TabItem>                
            </basics:TabControl>
        </Grid>
    </Grid>
</sdk:Page>
